package com.itmg.analyze.jp.url.impl;

import org.apache.log4j.Logger;

import com.itmg.analyze.jp.bean.YahooAuctionsParaBean;
import com.itmg.analyze.jp.model.YahooAuctionsSearchParamModel;
import com.itmg.analyze.jp.url.IURLAnalyze;
import com.itmg.vo.SearchParameterVO;
import com.itmg.vo.TargetDataVO;

/**
 *  获得匹配好的url
 * @author Yunhong Chen
 * */

public class YahooAuctionsURlAnlyzeImpl implements IURLAnalyze {
	protected Logger log = Logger.getLogger(YahooAuctionsURlAnlyzeImpl.class.getName());
	private String rootURL = "http://auctions.yahooapis.jp/AuctionWebService/V1/Search";
	private String developID = "7SR.K62xg671znW2mW6wiwOl.WNkq3l9En75hYxHOke59NqJhPtBqI_FHa1w9it1";
	private Integer page = 1;
	private String sourceSiteName = "auctions.yahoo.co.jp";
	
	public YahooAuctionsURlAnlyzeImpl() {
	}
	
	public TargetDataVO getURLDataByParameter(SearchParameterVO searchParameterVO) throws Exception {
		YahooAuctionsSearchParamModel yahooAuctionsSearchParamModel = YahooAuctionsParaBean.getYahooAuctionsSearchParamModel(searchParameterVO);
		yahooAuctionsSearchParamModel.setAppid(developID);
		yahooAuctionsSearchParamModel.setPage(page);
		TargetDataVO targetDataVO = new TargetDataVO();
		targetDataVO.setSourceSiteName(sourceSiteName);
		targetDataVO.setUrl(rootURL+yahooAuctionsSearchParamModel.getURLPara());
log.info(targetDataVO.getUrl());
		return targetDataVO;
	}
}
